package com.czmh.etc.interpreter.entity.base;

import java.io.UnsupportedEncodingException;

/**
 * Created by Huangyk on 2019/6/5.
 */
public class ResponseBody extends ResponseBodyBase {
    public static int BODY_LEN = ResponseBodyBase.BOSY_BASE_LEN + 21;

    private String PosID;
    private String TerminalID;

    public ResponseBody(EnMessagetype msgType) {
        super(msgType);
    }

    public ResponseBody(String rep) throws UnsupportedEncodingException {
        super(rep.substring(0, ResponseBodyBase.BOSY_BASE_LEN));

        byte[] repBytes = rep.getBytes(InterpreterContent.CHARACTER_SET);

        int currPos = ResponseBodyBase.BOSY_BASE_LEN;

        this.PosID = getStringFromBytes(repBytes, currPos, 7);
        currPos += 7;

        this.TerminalID = getStringFromBytes(repBytes, currPos, 14).trim();
    }

    //region getter && setter
    public String getPosID() {
        return PosID;
    }

    public void setPosID(String posID) {
        PosID = posID;
    }

    public String getTerminalID() {
        return TerminalID;
    }

    public void setTerminalID(String terminalID) {
        TerminalID = terminalID;
    }
    //endregion
}
